from rest_framework import serializers
from django.contrib.auth.models import Group

class GroupModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = Group
        fields = ['id', 'name', 'permissions']

    # def create(self, validated_data):
    #     permission_list = validated_data.pop('permissions')
    #     instance = self.Meta.model.objects.create(**validated_data)
    #     instance.permissions.set(permission_list)
    #     return instance
